<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" >
        <title>数组练习</title>
    </head>
    <body>
        <script>
            var arr = [1,2,3,4,5,6,7,8,9];
            var string= '1^2^3^45^67^89'
            // 截取数组  4-7
            var jie = arr.slice(3,7);
            // 修改数组
            var xiu = arr.splice(2,5,'wo');
            // 数组转字符串
            var zifu = arr.join(',');
            // 字符串转数组
            var shu = string.split('^',5);
            console.log('截取新数组--'+jie);
            console.log('修改新数组--'+xiu);
            console.log('数组转字符串--'+zifu);
            console.log('字符串转数组--'+shu);
            
        </script>
    </body>
</html>